#include<iostream>
using namespace std;
void citire(int v[],int&n)
{
    int i;
    std::cout<<"n=";std::cin>>n;
    for(i=0;i<n;i++)
        {std::cout<<"v["<<i<<"]=";std::cin>>v[i];}
}
void afisare(int v[],int n)
{
    int i;
    for(i=0;i<n;i++)
        std::cout<<"v["<<i<<"]="<<v[i]<<endl;
}
int prim(int x)
{
    int d;
    if(x==0||x==1)
        return 0;
    else
    {
        for(d=2;d<=x/2;d++)
            if(x%d==0)
                return 0;
            return 1;
    }
}
int main()
{
    int i,v[100],n,p=0,m=0;
    citire(v,n);
    for(i=0;i<n;i++)
    {
        if(v[i]!=0)
            {v[m]=v[i];m++;}
        if(prim(v[i]))
            {v[p]=v[i];p++;}
    }
        std::cout<<endl<<"Numere nenule:"<<endl;
        afisare(v,m);
        std::cout<<endl<<"Numere prime"<<endl;
        if(p!=0)
        afisare(v,p);
        else
            std::cout<<"Nu exista niciun numar prim";
}
